package ar.edu.unrn.lia.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.springframework.security.core.GrantedAuthority;

@Entity
@Table(name = "role")
public class Role extends BaseEntity implements GrantedAuthority,  Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7111014531347841492L;
	
	private String description;

	public Role() {
		super();
		setId(null);
		this.description = null;
	}

	public Role(Long id, String description) {
		super();
		setId(id);
		this.description = description;
	}

	@NotNull(message = "{name.notnull}")
	@Size(min = 5, max = 35, message = "{name.size}")
	@Column(name = "description", nullable = false)
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
	@Transient
	public String getAuthority() {
		
		return this.description;
	}

}
